import uuid

from loguru import logger
from .http import client

headers = {
	"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
	"Referer": "https://cloudstudio.net/home",
	"X-Studio-token": "6C5550BDD600C3456FF13CA0EF9E359097DFCFBDCCF3D31FF945FFFFA9C6979CF944A97463487D5E3E72BDC5E2F961E5",
	"Cookie": 'cloudstudio-session-team=wx; cloudstudio-session=61c83e45-0a28-4188-8193-4e23528b0889.493409b3-7892-423b-a05d-1cda3e072707.2ecef21e-51f8-4ce4-91d4-340d1277407f',
	"x-xsrf-token": "992898630",
}


@logger.catch
async def activity_task():
	headers["traceparent"] = "-".join(["00", str(uuid.uuid4()).replace("-", ""), str(uuid.uuid4()).replace("-", "")[0:16], "01"])

	response = await client.post("https://cloudstudio.net/api/billing/activityTask/SIGN_IN_2025Q3/_reward", headers=headers)
	logger.info(f"cloudstudio activity_task {response.status_code=}")
	logger.info(f"cloudstudio activity_task {response.json()=}")
	if response.is_success:
		headers["traceparent"] = "-".join(["00", str(uuid.uuid4()).replace("-", ""), str(uuid.uuid4()).replace("-", "")[0:16], "01"])
		r = await client.get("https://cloudstudio.net/api/billing/resource/_summary", headers=headers)
		logger.info(f"cloudstudio _summary {r.status_code=}")
		logger.info(f"cloudstudio _summary {r.json()=}")
